<?php
/*
 * 项目安装配置文件
 */
class InstallTask extends Phalcon\CLI\Task
{
    var $APP = 'base';
    var $TABLENAME = '';
    public function mainAction(){
        //数据库相关
        $this->installSql(APP_PATH . '/App/Base/DBschema/');
        //$DBTable = new Base\Lib\Application\dbtable('kvstore','base');
        //$sql = $DBTable->get_sql('kvstore','base'); 
        //$res = $DBTable->install();
        //_p($res);
    } 
    /*
     * 数据库文件安装
     */
    public function installSql($app_path){
        //_p($app_path);
        $mydir = dir($app_path);
        //_p($mydir);
        $config_arr = array();
	while($file = $mydir->read()){
              //var_dump($app);
            if ($file != '.' && $file != '..') {
                if (is_readable($app_path.$file)) {
                    $this->TABLENAME = basename($app_path.$file,".php");
                    //_p($this->TABLENAME);
                    $DBTable = new Base\Lib\Application\DBTable($this->TABLENAME,$this->APP);
                    $res = $DBTable->install();
                    //_p($res);
                }
                
            }
	}
	$mydir->close();   
    }    
}